package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Tel      string `gorm:"type:varchar(30)" json:"tel"`
	Password string `gorm:"type:varchar(255)" json:"password"`
}
type Newspaper struct {
	gorm.Model
	Title      string `gorm:"type:varchar(30)" json:"title"`
	Content    string `gorm:"type:varchar(30)" json:"content"`
	Img        string `gorm:"type:varchar(255)" json:"img"`
	UserID     int    `gorm:"type:int" json:"user_id"`
	User       User   `gorm:"foreignKey:UserID" json:"user"`
	LikeCount  int    `gorm:"type:int" json:"like_count"`
	GuanoCount int    `gorm:"type:int" json:"guano_count"`
}
type Like struct {
	gorm.Model
	UserID      int       `gorm:"type:int" json:"user_id"`
	User        User      `gorm:"foreignKey:UserID" json:"user"`
	NewspaperID int       `gorm:"type:int" json:"newspaper_id"`
	Newspaper   Newspaper `gorm:"foreignKey:NewspaperID" json:"newspaper"`
}

type Guano struct {
	gorm.Model
	UserID      int       `gorm:"type:int" json:"user_id"`
	User        User      `gorm:"foreignKey:UserID" json:"user"`
	NewspaperID int       `gorm:"type:int" json:"newspaper_id"`
	Newspaper   Newspaper `gorm:"foreignKey:NewspaperID" json:"newspaper"`
}
